package com.xxx.user.service.impl;

import com.github.pagehelper.PageHelper;
import com.xxx.user.domain.Dict;
import com.xxx.user.domain.DictItem;
import com.xxx.user.mapper.DictMapper;
import com.xxx.user.query.DictQuery;
import com.xxx.user.service.IDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DictServiceImpl implements IDictService {
    @Autowired
    private DictMapper dictMapper;

    @Override
    public List<Dict> findAll() {
        return dictMapper.findAll();
    }

    @Override
    public Dict findOne(Long id) {
        return dictMapper.findOne(id);
    }

    @Override
    public List<Dict> queryPage(DictQuery dictQuery) {
        PageHelper.startPage(dictQuery.getCurrentPage(), dictQuery.getPageSize());
        PageHelper.clearPage();
        return dictMapper.queryPage(dictQuery);
    }

    @Override
    public void addDict(Dict dict) {
        dictMapper.addDict(dict);
    }

    @Override
    public void updateDict(Dict dict) {
        dictMapper.updateDict(dict);
    }

    @Override
    public void deleteDict(Long id) {
        dictMapper.deleteDict(id);
    }

    @Override
    public void batchDict(Long[] ids) {
        dictMapper.batchDict(ids);
    }

    @Override
    public List<DictItem> getdictItem(Long id) {
        List<DictItem> dictItem = dictMapper.getdictItem(id);
        return dictItem;
    }
}
